/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import utils.ClientConfiguration;
import utils.MaximizeWindow;

/**
 *
 * @author linux
 */
public class MainFrameController {
    
    private static MainFrameController instance;
    private MainFrame mFrame;
    
    public MainFrameController() {
        try {
            ClientConfiguration.setConfiguaracionCliente("./ClientConfiguration.conf");
            ConnectionSigleton connectionSingleton = ConnectionSigleton.getInstance();
            connectionSingleton.CreateSocket(ClientConfiguration.getHost(), new Integer(ClientConfiguration.getPort()));
        } catch (IOException ex) {
            Logger.getLogger(MainFrameController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    
    public static MainFrameController getInstance(){
        if(instance == null){
            
            instance = new MainFrameController();
        }
        return instance;
    }
    
    public void show(){
        if(mFrame == null){
            mFrame = new MainFrame();
        }
        if (!mFrame.isVisible()){
           //MaximizeWindow.MaximizeWindow(mFrame);
           mFrame.setLocationRelativeTo(null);
           mFrame.setVisible(true);
        }else {
           mFrame.pack();
        }
    }
}
